function checkFrm() {
    $("#submitBtn").html("正在提交...");
    $("#submitBtn").addClass("layui-btn-disabled");
}
var optionTmp = {
    type: "post",
    dataType: "json",
    beforeSubmit: checkFrm,
    url: doAddUrl,
    success: function (data) {
        dialog.alert(data.msg);
        if (data.flag) {
            window.location.href = backUrl ? backUrl : listUrl;
        } else {
            $("#submitBtn").html("确定提交");
            $("#submitBtn").removeClass("layui-btn-disabled");
        }
    },
    error: function () {
        dialog.alert("接口异常");
        $("#submitBtn").html("确定提交");
        $("#submitBtn").removeClass("layui-btn-disabled");
        $("#upfile").val("");
    }
};

$("#submitBtn").click(function () {
    $("#addFrm").ajaxSubmit(optionTmp);
});


function delImage(id) {
    if (id > 0) {
        layer.confirm('确定删除此图片吗？', function (index) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: delImageUrl,
                data: {
                    image_id: id
                },
                success: function (data) {
                    if (data.flag) {
                        $("#image_li_" + id).remove();
                    } else {
                        layer.msg(data.msg, {icon: 2});
                    }
                }
            });
            layer.close(index);
        });
    }
}